/*
 * evhdl.h
 *
 *  Created on: Nov 15, 2013
 */

#ifndef EVHDL_H_
#define EVHDL_H_

#include "Common.h"
#include "evhdl_events.h"

#define EVHD__nRegisterMask		((uint8)0x80)
#define EVHD__nEVActiveMask		((uint8)0x20)

typedef struct
{
	uint8 u8rEeventDescritpor[EV_NumberOfRecEvents];
} EVHD_tstData;

/**
 * This function is for module initialization 
 * @param void
 * @return void	
 */
void EVHD_vSInit(void);

/**
 * This function registers a single receive event.
 * This function can be used within the whole Sys context.	
 * @param enReceiveEvent Receive event that shall be registered
 * @return void	
 */
void EVHD_vRegister(EVHD_tenEvents enReceiveEvent);

/**
 * This function de-regigisters one receive event.
 * De-registered events will not be called until they are registered again.
 * This function can be used within the whole OS context.	
 * @param enReceiveEvent Receive event that shall be de-registered
 * @return void	
 */
void EVHD_vDeregister(EVHD_tenEvents enReceiveEvent);

/**
 * This function sends the "Send Event" to the configured receiver functions.	
 * This function can be used within the whole OS context.
 * @param enSendEvent Send event number that should be executed
 * @return void
 */
void EVHD_vSendEvent(EVHD_tenEvents enSendEvent);

/**
 * This function is used to read the value of a receive event.
 * The value of this Event will be cleared automatically.
 * This function can be used within the whole OS context.
 * @param enReceiveEvent Receive event that should be read
 * @return The requested event
 *         0: Event bit was not set
 *         1: Event bit was set
 */
bool EVHD_boReadEvent(EVHD_tenEvents enReceiveEvent);

/**
 * This function is the dispatcher itself.
 * The dispatcher will call the configured application functions if the corresponding event bits and mask bits are set.
 * Directly before the application function is called the event bit is cleared.	
 * This task will be terminated after all events are dispatched.	
 * @param void
 * @return void
 */
void EVHD_vStartDispatcher(void);


#endif /* EVHDL_H_ */
